/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.gis.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;

/**
* 地磅数据(流入)
**/
@Entity
@Data
@Table(name="futai_in")
@ApiModel("地磅数据(流入)")
public class WeighbridgeIn implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`in_id`")
    @ApiModelProperty(value = "主键自增ID")
    private Long id;

    @Column(name = "`ftid`")
    @ApiModelProperty(value = "伏泰ID")
    private String ftId;

    @Column(name = "`system_code`")
    @ApiModelProperty(value = "系统编号")
    private String systemCode;

    @Column(name = "`source_unit`")
    @ApiModelProperty(value = "发货单位")
    private String sourceUnit;

    @Column(name = "`memo`")
    @ApiModelProperty(value = "备注")
    private String memo;

    @Column(name = "`no`")
    @ApiModelProperty(value = "no")
    private String no;

    @Column(name = "`term_id`")
    @ApiModelProperty(value = "term_id")
    private Integer termId;

    @Column(name = "`area`")
    @ApiModelProperty(value = "区域")
    private String area;

    @Column(name = "`area_zone`")
    @ApiModelProperty(value = "时区")
    private String areaZone;

    @Column(name = "`weight_no`")
    @ApiModelProperty(value = "地磅名称")
    private String weightNo;

    @Column(name = "`driver`")
    @ApiModelProperty(value = "司机")
    private String driver;

    @Column(name = "`ic_code`")
    @ApiModelProperty(value = "卡号")
    private String icCode;

    @Column(name = "`dispose_unit_code`")
    @ApiModelProperty(value = "处置单位代码")
    private String disposeUnitCode;

    @Column(name = "`dispose_unit_name`")
    @ApiModelProperty(value = "处置单位名称")
    private String disposeUnitName;

    @Column(name = "`weigh_man`")
    @ApiModelProperty(value = "出单人")
    private String weighMan;

    @Column(name = "`car_inner_code`")
    @ApiModelProperty(value = "卡车内部号")
    private String carInnerCode;

    @Column(name = "`tare_weight`")
    @ApiModelProperty(value = "皮重（吨）")
    private BigDecimal tareWeight;

    @Column(name = "`gross_weight`")
    @ApiModelProperty(value = "毛重（吨）")
    private BigDecimal grossWeight;

    @Column(name = "`net_weight`")
    @ApiModelProperty(value = "净重（吨）")
    private BigDecimal netWeight;

    @Column(name = "`car_no`")
    @ApiModelProperty(value = "车牌号")
    private String carNo;

    @Column(name = "`transport_unit`")
    @ApiModelProperty(value = "运输单位")
    private String transportUnit;

    @Column(name = "`product_name`")
    @ApiModelProperty(value = "货物名称")
    private String productName;

    @Column(name = "`tare_time`")
    @ApiModelProperty(value = "皮重称重时间(时间戳)")
    private Long tareTime;

    @Column(name = "`tare_time_str`")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "皮重称重时间")
    private Date tareTimeStr;

    @Column(name = "`gross_time`")
    @ApiModelProperty(value = "毛重称重时间(时间戳)")
    private Long grossTime;

    @Column(name = "`gross_time_str`")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "毛重称重时间")
    private Date grossTimeStr;

    @Column(name = "`product_to_where`")
    @ApiModelProperty(value = "车间名称")
    private String productToWhere;

    @Column(name = "`date_operate`")
    @ApiModelProperty(value = "操作日期")
    private String dateOperate;

    @Column(name = "`create_time`")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @Column(name = "`source_unit_inner_code`")
    @ApiModelProperty(value = "发货单位内部编号")
    private String sourceUnitInnerCode;

    @Column(name = "`transport_unit_inner_code`")
    @ApiModelProperty(value = "运输单位内部编号")
    private String transportUnitInnerCode;

    @Column(name = "`price`")
    @ApiModelProperty(value = "价格")
    private BigDecimal price;

    @Column(name = "`total_price`")
    @ApiModelProperty(value = "总价")
    private BigDecimal totalPrice;

    @Column(name = "`deduct_weight`")
    @ApiModelProperty(value = "核减重量(吨)")
    private BigDecimal deductWeight;

    @Column(name = "`data_status_str`")
    @ApiModelProperty(value = "数据状态")
    private String dataStatusStr;

    @Column(name = "`handle_unit`")
    @ApiModelProperty(value = "解决单位")
    private String handleUnit;

    @Column(name = "`import_time`")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "导入时间")
    private Date importTime;

    public void copy(WeighbridgeIn source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
